# eric7.EricWidgets.EricSideBar

Module implementing a sidebar class.

### Global Attributes

None

### Classes

EricSideBar | Class implementing a sidebar with a widget area, that is hidden or shown, if the current tab is clicked again.
EricSideBarSide | Class defining the sidebar sides.

### Functions

None

## EricSideBar

Class implementing a sidebar with a widget area, that is hidden or shown, if the current tab is clicked again.

### Signals

currentChanged(index)
  emitted to indicate a change of the current index

### Derived from

QWidget

### Class Attributes

Version

### Class Methods

None

### Methods

EricSideBar | Constructor
__currentIconChanged | Private slot to handle a change of the current icon.
__expandIt | Private method to expand the sidebar.
__shrinkIt | Private method to shrink the sidebar.
__shrinkOrExpandIt | Private slot to shrink or expand the widget stack.
addTab | Public method to add a tab to the sidebar.
barSize | Public method to get the icon bar size.
clear | Public method to remove all tabs.
count | Public method to get the number of tabs.
currentIndex | Public method to get the index of the current tab.
currentWidget | Public method to get a reference to the current widget.
iconBarColor | Public method to get the icon bar color.
indexOf | Public method to get the index of the given widget.
insertTab | Public method to insert a tab into the sidebar.
isMinimized | Public method to check the minimized state.
nextTab | Public slot used to show the next tab.
orientation | Public method to get the orientation of the sidebar.
prevTab | Public slot used to show the previous tab.
removeTab | Public method to remove a tab.
restoreState | Public method to restore the state of the sidebar.
saveState | Public method to save the state of the sidebar.
setCurrentIndex | Public slot to set the current index.
setCurrentWidget | Public slot to set the current widget.
setIconBarColor | Public method to set the icon bar color.
setIconBarSize | Public method to set the icon bar size.
setOrientation | Public method to set the orientation of the sidebar.
setTabIcon | Public method to set the icon at the given index.
widget | Public method to get a reference to the widget associated with a tab.

### Static Methods

None

#### EricSideBar (Constructor)

EricSideBar(orientation=None, iconBarSize=EricIconBar.DefaultBarSize, parent=None)

Constructor

orientation (EricSideBarSide)
  orientation of the sidebar widget
iconBarSize (str)
  size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')
parent (QWidget)
  parent widget

#### EricSideBar.__currentIconChanged

__currentIconChanged(index)

Private slot to handle a change of the current icon.

index (int)
  index of the current icon

#### EricSideBar.__expandIt

__expandIt()

Private method to expand the sidebar.

#### EricSideBar.__shrinkIt

__shrinkIt()

Private method to shrink the sidebar.

#### EricSideBar.__shrinkOrExpandIt

__shrinkOrExpandIt()

Private slot to shrink or expand the widget stack.

#### EricSideBar.addTab

addTab(widget, icon, label=None)

Public method to add a tab to the sidebar.

widget (QWidget)
  reference to the widget to add
icon (QIcon)
  reference to the icon of the widget
label (str)
  the label text of the widget

#### EricSideBar.barSize

barSize()

Public method to get the icon bar size.

Return:
  barSize size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')

Return Type:
  str

#### EricSideBar.clear

clear()

Public method to remove all tabs.

#### EricSideBar.count

count()

Public method to get the number of tabs.

Return:
  number of tabs in the sidebar

Return Type:
  int

#### EricSideBar.currentIndex

currentIndex()

Public method to get the index of the current tab.

Return:
  index of the current tab

Return Type:
  int

#### EricSideBar.currentWidget

currentWidget()

Public method to get a reference to the current widget.

Return:
  reference to the current widget

Return Type:
  QWidget

#### EricSideBar.iconBarColor

iconBarColor()

Public method to get the icon bar color.

Return:
  icon bar color

Return Type:
  QColor

#### EricSideBar.indexOf

indexOf(widget)

Public method to get the index of the given widget.

widget (QWidget)
  reference to the widget to get the index of

Return:
  index of the given widget

Return Type:
  int

#### EricSideBar.insertTab

insertTab(index, widget, icon, label=None)

Public method to insert a tab into the sidebar.

index (int)
  the index to insert the tab at
widget (QWidget)
  reference to the widget to insert
icon (QIcon)
  reference to the icon of the widget
label (str)
  the label text of the widget

#### EricSideBar.isMinimized

isMinimized()

Public method to check the minimized state.

Return:
  flag indicating the minimized state

Return Type:
  bool

#### EricSideBar.nextTab

nextTab()

Public slot used to show the next tab.

#### EricSideBar.orientation

orientation()

Public method to get the orientation of the sidebar.

Return:
  orientation of the sidebar

Return Type:
  EricSideBarSide

#### EricSideBar.prevTab

prevTab()

Public slot used to show the previous tab.

#### EricSideBar.removeTab

removeTab(index)

Public method to remove a tab.

index (int)
  the index of the tab to remove

#### EricSideBar.restoreState

restoreState(state)

Public method to restore the state of the sidebar.

state (QByteArray)
  byte array containing the saved state

Return:
  flag indicating success

Return Type:
  bool

#### EricSideBar.saveState

saveState()

Public method to save the state of the sidebar.

Return:
  saved state as a byte array

Return Type:
  QByteArray

#### EricSideBar.setCurrentIndex

setCurrentIndex(index)

Public slot to set the current index.

index (int)
  the index to set as the current index

#### EricSideBar.setCurrentWidget

setCurrentWidget(widget)

Public slot to set the current widget.

widget (QWidget)
  reference to the widget to become the current widget

#### EricSideBar.setIconBarColor

setIconBarColor(color)

Public method to set the icon bar color.

color (QColor)
  icon bar color

#### EricSideBar.setIconBarSize

setIconBarSize(barSize)

Public method to set the icon bar size.

barSize (str)
  size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')

#### EricSideBar.setOrientation

setOrientation(orient)

Public method to set the orientation of the sidebar.

orient (EricSideBarSide)
  orientation of the sidebar

#### EricSideBar.setTabIcon

setTabIcon(index, icon)

Public method to set the icon at the given index.

index (int)
  icon index
icon (QIcon)
  reference to the icon

#### EricSideBar.widget

widget(index)

Public method to get a reference to the widget associated with a tab.

index (int)
  index of the tab

Return:
  reference to the widget

Return Type:
  QWidget

Up

## EricSideBarSide

Class defining the sidebar sides.

### Derived from

enum.Enum

### Class Attributes

EAST
NORTH
SOUTH
WEST

### Class Methods

None

### Methods

None

### Static Methods

None

Up